/**$Licence:
 *   Use this however/wherever you like, just don't blame me if it breaks anything.
 *   Copyright (C) 2008 - 2013 xingsheng.zhu@gmail.com All rights reserved.
 */
package com.blazemina;

import com.blazemina.config.BlazeminaConfig;
import com.blazemina.config.BlazeminaConfigManager;
import com.blazemina.container.AbstractServer;
import com.blazemina.container.Container;
import com.blazemina.mina.Connector;
import com.blazemina.mina.acceptor.AbstractAcceptor;

/**
 * @author JackChu
 * @version 2.0.0 2013-2-22 下午6:55:10
 */
public abstract class BlazeminaServer {
	
	private Connector connector = new AbstractAcceptor();
	private Container container = new AbstractServer();
	
	private BlazeminaConfig blazeminaConfig;
	
	
	private void init(){
		blazeminaConfig = configBlazemina();
		container.init(blazeminaConfig);
		connector.init();
	}
	
	public void start(){
		init();
		connector.start();
		container.start();
	}
	
	public void stop() {
		connector.stop();
		container.stop();
	}
	
	protected abstract BlazeminaConfig configBlazemina();

}
